<template>
  <div id="app">
    <h1>{{time}}</h1>
    <HelloWorld msg="Welcome to Your Vue.js App" />
    <!-- 使用组件 -->
    <hr />
    <XxCounter @xx-yy="customHandler"></XxCounter>
    <XxCounter></XxCounter>
  </div>
</template>

<script>
import HelloWorld from "./components/HelloWorld.vue";
// 引入组件文件
import XxCounter from "./components/XxCounter.vue";

export default {
  name: "App",
  components: {
    HelloWorld,
    XxCounter,
  },
  // 注册组件

  data: function () {
    return {
      time: "123",
    };
  },
  methods: {
    customHandler: function () {
      console.log(123);
      this.time = Math.random();
    },
  },
};
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
